package com.example.nacosdemo1.controller;

import com.example.nacosdemo1.config.PatternConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@RestController
@RequestMapping("/configDemo")
public class ConfigDemoController {
    @Autowired
    private PatternConfig config;

    @GetMapping("/now")
    public String now(){

        return LocalDateTime.now().format(DateTimeFormatter.ofPattern(config.getDatefromat()));
    }


}
